From 143d11f435570c330d3c06981479578ab76543f3 Mon Sep 17 00:00:00 2001 From: Arturo Espinosa Date: Sat, 23 Oct 1999 00:06:10 +0000 Subject: [PATCH] Sync to laptop - Federico --- gdk-pixbuf/gnome-canvas-pixbuf.c | 92 ++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/gdk-pixbuf/gnome-canvas-pixbuf.c b/gdk-pixbuf/gnome-canvas-pixbuf.c index dd1a5f3521..79dc9bb7c0 100644 --- a/gdk-pixbuf/gnome-canvas-pixbuf.c +++ b/gdk-pixbuf/gnome-canvas-pixbuf.c @@ -21,13 +21,48 @@ */ #include +#include "gdk-pixbuf.h" #include "gnome-canvas-pixbuf.h" +/* Private part of the GnomeCanvasPixbuf structure */ +typedef struct { + /* Our gdk-pixbuf */ + GdkPixbuf *pixbuf; + + /* Width value */ + double width; + + /* Height value */ + double height; + + /* Whether dimensions are set and whether they are in pixels or units */ + guint width_set : 1; + guint width_pixels : 1; + guint height_set : 1; + guint height_pixels : 1; +} PixbufPrivate; + + + +/* Object argument IDs */ +enum { + ARG_0, + ARG_PIXBUF, + ARG_WIDTH, + ARG_WIDTH_SET, + ARG_WIDTH_PIXELS, + ARG_HEIGHT, + ARG_HEIGHT_SET, + ARG_HEIGHT_PIXELS +}; + static void gnome_canvas_pixbuf_class_init (GnomeCanvasPixbufClass *class); static void gnome_canvas_pixbuf_init (GnomeCanvasPixbuf *cpb); static void gnome_canvas_pixbuf_destroy (GtkObject *object); +static void gnome_canvas_pixbuf_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); +static void gnome_canvas_pixbuf_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); static GnomeCanvasItemClass *parent_class; @@ -67,3 +102,60 @@ gnome_canvas_pixbuf_get_type (void) } /* Class initialization function for the pixbuf canvas item */ +static void +gnome_canvas_pixbuf_class_init (GnomeCanvasPixbufClass *class) +{ + GtkObjectClass *object_class; + GnomeCanvasItemClass *item_class; + + object_class = (GtkObjectClass *) class; + item_class = (GnomeCanvasItemClass *) class; + + parent_class = gtk_type_class (gnome_canvas_item_get_type ()); + + gtk_object_add_arg_type ("GnomeCanvasPixbuf::pixbuf", + GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_PIXBUF); + gtk_object_add_arg_type ("GnomeCanvasPixbuf::width", + GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_WIDTH); + gtk_object_add_arg_type ("GnomeCanvasPixbuf::width_set", + GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_WIDTH_SET); + gtk_object_add_arg_type ("GnomeCanvasPixbuf::width_pixels", + GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_WIDTH_PIXELS); + gtk_object_add_arg_type ("GnomeCanvasPixbuf::height", + GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_HEIGHT); + gtk_object_add_arg_type ("GnomeCanvasPixbuf::height_set", + GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HEIGHT_SET); + gtk_object_add_arg_type ("GnomeCanvasPixbuf::height_pixels", + GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HEIGHT_PIXELS); + + object_class->destroy = gnome_canvas_pixbuf_destroy; + object_class->set_arg = gnome_canvas_pixbuf_set_arg; + object_class->get_arg = gnome_canvas_pixbuf_get_arg; + + item_class->update = gnome_canvas_pixbuf_update; + item_class->draw = gnome_canvas_pixbuf_draw; + item_class->point = gnome_canvas_pixbuf_point; + item_class->bounds = gnome_canvas_pixbuf_bounds; +} + +/* Object initialization function for the pixbuf canvas item */ +static void +gnome_canvas_pixbuf_init (GnomeCanvasPixbuf *gcp) +{ + PixbufPrivate *priv; + + priv = g_new0 (PixbufPrivate, 1); + gcp->priv = priv; + + priv->width = 0.0; + priv->height = 0.0; +} + +static void +gnome_canvas_pixbuf_destroy (GtkObject *object) +{ + g_return_if_fail (object != NULL); + g_return_if_fail (GNOME_IS_CANVAS_PIXBUF (object)); + + +} -- 2.30.2